package com.yuanfeng.userms.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanfeng.commoms.vo.fx.GoodsVkSetVO;
import com.yuanfeng.commoms.vo.fx.ShareGoodsVO;
import com.yuanfeng.commoms.vo.fx.VKUserInfoVO;
import com.yuanfeng.commoms.vo.goods.FXGoodsListVO;
import com.yuanfeng.userms.entity.UserVkEntity;
import com.yuanfeng.userms.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @ClassName UserVkMapper
 * @Description  店铺微客会员表
 * @Author cyp
 * @Date 2023-06-05 11:00:51
 * @Version 1.0
 **/
@Mapper
public interface UserVkMapper extends BaseMapper<UserVkEntity> {

     /**
      * 查询微客用户信息
      * @param paraMap
      * @return
      */
     VKUserInfoVO queryVKUserInfo(Map<String, String> paraMap);

     /**
      * 更新分销数据
      * @param shareGoods
      */
     void updateVkCommission(@Param("shareGoods")ShareGoodsVO shareGoods);
    /**
     * 更新分销数据
     * @param shareGoods
     */
    void updateVkCommission2(@Param("shareGoods")ShareGoodsVO shareGoods);

    /**
     * 查询店铺名称
     * @param userBindShopId
     * @return
     */
    String queryShopName(Integer userBindShopId);

    /**
     * 查询微客申请表
     * @param userId
     * @param shopId
     * @return
     */
    ShopVkApplyVO queryShopVkApply(@Param("userId") String userId, @Param("shopId") Integer shopId);

    /**
     * 插入微客信息
     * @param shopVKUserVO
     */
    void insertSelective(ShopVKUserVO shopVKUserVO);

    /**
     * 修改推广数
     * @param userId
     */
    void updateVkTgNum(String userId);

    /**
     * 插入 申请记录
     * @param vkApply
     */
    void insertVkApplySelective(ShopVkApplyVO vkApply);

    /**
     * 修改申请记录
     * @param buyNum
     * @param applyStatus
     * @param id
     */
    void updateApplyBuyNum(@Param("buyNum") Integer buyNum, @Param("applyStatus") Integer applyStatus, @Param("id") Integer id);


    /**
     * 查询购买用户 是否是 微客
     * @param userId
     * @return
     */
    Integer queryVkStart(@Param("userId")String userId);

    /**
     * 查询用户是否注册
     * @param userId
     * @return
     */
    Map<String, Object> queryUserReg(@Param("userId") String userId);

    /**
     * 校验当前用户是否已经成为微客
     * @param regStart
     * @return
     */
    Integer queryUserVkStart(@Param("param")Map<String, Object> regStart);

    void addVkUser(@Param("param")Map<String, Object> regStart);

    /**
     * 将推广佣金更新 回订单佣金记录表
     * @param orderId
     * @param tgCommission
     * @param tgRate
     */
    void updateOrderTGCommission(@Param("orderId") String orderId, @Param("tgCommission") BigDecimal tgCommission,@Param("tgRate") String tgRate);

    GoodsVkSetVO queryGoodsVkSet();

    String queryGoodsTgRate(@Param("goodsId")Integer goodsId);

    void updateVkTgCommission(@Param("shareUserId") Integer shareUserId, @Param("tgCommission") BigDecimal tgCommission);

    VKUserVO queryShopVkUser1(String userId);

    Integer queryVKUserList1(@Param("userId") String userId);

    IPage<MallVkCommissionVO> queryVKUserList(IPage page, @Param("param") MallVkQueryVO mallVkQuery);

    List<ShopStoreInfoVO> queryByShop(Integer shopId);

    ShopVKUserVO queryVKUserDetail(@Param("userId") String userId);

    VKUserInfoVO queryVkUser(@Param("userId") String userId);

    IPage<YgRankVO> queryUserRankList(Page<YgRankVO> page,@Param("param") YgRankVO ygRank);

    IPage<TodayShareGoodsVO> queryTodayShareGoods(Page<TodayShareGoodsVO> page,@Param("param") FXGoodsListVO goodsListRequest);
}
